﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace admin.cyt369.com.Models.Orgs
{
    public class OrganizationTree : Admin.CYT369.Com.DAL.Domains.Organization
    {
        public OrganizationTree(Admin.CYT369.Com.DAL.Domains.Organization organization)
        {
            this.Id = organization.Id;
            this.ParentID = organization.ParentID;
            this.FullName = organization.FullName;
            this.ShortName = organization.ShortName;
            this.PhoneNumber = organization.PhoneNumber;
            this.Email = organization.Email;
            this.PostCode = organization.PostCode;
            this.Address = organization.Address;
            this.Latitude = organization.Latitude;
            this.Longitude = organization.Longitude;
            this.iconCls = "fa fa-support";
        }

        public int id {
            get {
                return this.Id;
            }
        }

        public int? parentId {
            get { return this.ParentID == 0 ? null : (int?)this.ParentID; }
            set { this.ParentID = value.HasValue ? value.Value : 0; }
        }

        public string text {
            get { return this.FullName; }
        }

        public string iconCls { get; set; }

        public string state { get; set; }

        public List<admin.cyt369.com.Models.Orgs.OrganizationTree> children { get; set; }

    }
}
